home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 3
/
Gold Medal Software - Volume 3 (Gold Medal) (1994).iso
/
prog
/
proxy14.arj
/
RDB.PRX
< prev
next >
Wrap
Text File
|
1994-01-29
|
1KB
|
25 lines
// Sherlock Holmes relational database
struct crim {victim, crime, criminal, location;};
struct murd {victim, weapon, motive;};
crimes = {new crim("Phelps","robbery","Harrison","London"),
new crim("Drebber","murder","Hope","London"),
new crim("Sir Charles","murder","Stapleton","Devonshire"),
new crim("Lady Eva","blackmail","Milverton","London"),
new crim("Brunton","murder","Howells","West Sussex")};
murders = {new murd("Drebber","poison","revenge"),
new murd("Sir Charles","hound","greed"),
new murd("Brunton","burial-alive","passion")};
// Find the crimes of murder
murder_crimes = {x:x<-crimes;x.crime=="murder"};
// Find what murders occured in London
london_murder_crimes = {x:x<-murder_crimes;x.location == "London"};
// Project victim and criminal from above table
london_murder_victims = {[x.victim,x.criminal]:x<-london_murder_crimes};
// Find the criminals who either committed a murder by poisoning or
// committed a non-murder
criminals = {x.criminal:x<-crimes;x.crime != "murder"} U
{x.criminal:x<-crimes,y<-murders;(x.victim == y.victim)
&& (y.weapon == "poison")};
end